add file map related functions and previous bugs