Fixes several bugs in the console.

[*] Doesn't crash
[*] Closes connection
[*] Its faster