fixed search and reset: map shouldnt be initialized twice