Fix some compatibility issues