There's a glitch where building a factory in a province with a port destroys the port
Factories and ports don't build on top of each other.