some fixes in terms of map

Mainly, make a intermediate function to get the keys we want. 
Or actually, "initMainThread()" without the tick, if that's not ambiguous.