fix cleanup issues identified over code review