fix empty map bug, remove unnecessary code