Try to correct encoding in some cases
Fixed bug if you used a specified result file name
Removed debug