Fix tmp directories cleanup