Improve data dir parsing