Changed err port to optional