Fixes for compatibility with 1.8.7 and REE