Fixed some errors in throwing errors in `map` and `forEach`