workaround for onClosed and open PORT