Fixed a crash on invalid 'return' statement. Closes GH-964