more housekeeping and add COUNT(1)