Fix prepared statement cache issue