replace thread join with isAlive and sleep