handle optional parents in model init code gen