better handling of datadir