Loader fixes backport from vanilla
As discussed in #266 (closed). The backported loader changes are all in a single commit. The second commit (rev. 63a5ae55) merely bumps the vanilla version to 0.47.0 which is in order now because of the change of the loader_t callback type in the loader extension API.