Fixes #1

Invalid argument supplied for foreach() fixed