fixed bug that could cause a crash when appending an extension to the filename