get rid of 'Invalid argument supplied for foreach()' errors