fix error handling of sqlite prepared statements