Fix #2535 wrong return value

This PR is a fix for the issue #2535.