Fix: We must generate the file name first and then join with the dirpath