Fix the hanging bug.