Bug fixes for multiple port support