fix model.py to avoid a not-null constraint violation