fix dict logic