chg: better error check and debug stuff for newstruct/blackbox