1.8 compatibility changes

For comparison with #152 and #147