Add dir option and fix namespace for models