Fixed saving of port in the registry.