Fixed slight bugs with checking queue size (<= instead of <)