Fixed bug in the sql for rerun causing monitor page to raise an
exception