fixed file write bug in Filesystem