fix 'return' and add tests for it