More robust port checking
Bug fixes, yay