Solving dictionary error