Improved file name handling