fixed the 2way dict implementation