Fix bug in each; Fix tests for each