Fixed bug where improper code causes server to hang indefinitely.

closes #11 for good