Java 8 fix
(cherry picked from commit b719136)