fixed hang and did other minor clean up