Implemented filemap flushing and restoring