add med counts rake task, deal with nil values for sorting query results