added a thread safety for HashMaps