adds check for queue length