Refactored handling of some errors in gateway and port duplicates.
Merge branch 'develop' of https://github.com/Starcounter/Starcounter into develop