Check for out of bounds error on dictionary