detect the entrance of loop using hash map