Fix queue length bug