do not run foreach if result is null