Bug Fixes for empty input and whitespace

Bug #1: empty input caused client to loop indefinitely and server never got a thing.
Bug #2: whitespace first caused server to segfault