fix incorrect return value (issue #6202)