Fix error causing response to hang

fixes #5
fixes #7