Fixed bug when creating file.