Fixed bug in HashMap.add and added unit tests for it