Fix compatibility with 1.8 and ree and add unit-tests.