fixed #1. added optional port configuration