Fix null pointer on saving.