add function map and fix some ridiculous bug