Fixed two known bugs

Fixed the crashing after an amount of time bug and a bug that causes an
error when changing the port in the error recovery.