Made alreadyInQueue for REST API more reliable