fix dict bugs