Fixes for deprecations

Because of the `ifdefined` block, this should work on modern and older versions of Julia.