Fix being unable to change port function of serial port during runtime.
Closes #144.

Thanks @frank26080115