Corrected bug in DOISelectByStatus procedure