use a more proper way to handle prepare_file variable