fixed the hanging issue