Fix object creation to (a) not leak OBJs and (b) create the type intended.