filename correction and space at end of file removed (for Marmalade)