autoheader support and some err-handling fixes