fix some bugs e.g. dict insert val into same key