fix pattern matching in free_worker