fixed bug with cleaning up tmp dir