Fix throw exception on emit file

Fix issue #852
'returns'