updated wagn:update with better tmp dir handling