Minor fix to append_to_file
Minor modifications/fixes.