Java performance fix