Fixed bug with temp dirs and files