Fix throw exception on emit file

Fix issue #852
yes. I am fixing my comment