Empty resultset fix i think, untested.