move setting of object->type to alloc_* functions