Fixed error forming an extension of a filename