Fixed file creation bug