implement fix and test for #9
Implement a (crude) fix for issue #9 as well as adding the given example code to the test suite.
This should be considered a preliminary PR and I recommend that improvements be made before merging. In particular, testing the bug against regressions requires adding a hash() method to the public API for CHashMap, which is suboptimal.
Also worth improvement is the logic used in scan_mut() and scan().
This code is not performance critical as it is only used in the (rare) case where the bug would be triggered. However, there is significant code duplication at the moment.