Fixed incorrect query statement for waiting list