fix the rmdir stuff to clean up the temp dirs