Fixed bug in modify_file