make sure main_path is a file