fixing each_pair error