removed fs.flush()