update map file
add a check condition
remove unused codes