add conditional check for data dir