avoid detached unit bug