Fixes to PreparedStatements handling