fix query for reapplications in reapplication init script