Fixed bug on checkFilename 

Fixed bug on checkFilename which caused wrong file_out string construction