fix bug when no program was matching the SQL conditions