Improved error handling, print port number on startup