Handle changing the datadir properly.