compatibility with hadoop-2.x as well (borrowed adapter from EB)