Make sure errors caused by PREPARE requests are handled correctly

The latest rewrite of statement preparation removed the check for error responses to PREPARE requests, this puts it back again.

Fixes #45
Merge branch 'prepared_statement_fix'