Fixed dictionary index error