Check result of binding parameters, add sqlite_reset before binding

Thanks to dirkvdb for reporting the problem.