Prevent modifying map while accessing at the same time