Fixed saving with undefined index