added support for custom dir and port