Fix deprecated returnValue

Update after the comments received in PR #798