Fixed additional error conditions for comparing empty query results
Fixed major bug in comparison function