add check for queue length