Fixed some bugs where if no data was returned this was not checked.