fix bug on write_to_file and adjust interface command