Fix issue with template rendering / tmp file rename