Fix bug of saving settings