Improve data dir handling