Fix index issue with buildPreparedStatement