Fixed undefined index in presave function