fix nil issue
fix cleanup issue