Client-Server programs for a simple terminal chat, has bugs