Fix code for old jdk