fixed excessive prepared statement creation