fixed bug: hasKey returned true after key was removed