add tracebakcs and fix final_filename call before assignment