add halt type
fix leak
fix warnings