fixed a few bugs also support DEMOS_DATA_DIR parameter.