Fixed createFile being called on directories