Fix throw exception on emit file

Fix issue #852
Just call the function instead of storing the result in a variable.