fix div by zero problem if no rows are returned