Some cleanups. But still hangs.
fix hanging