Before trying to get PIKE_MODULE_RELOC working again, I would recommend rewriting (un)relocate_module to be based on lib_prefix instead of pike_module_path. That would avoid both bugs and gray hairs, since lib_prefix is A) a single directory, and B) not changed at runtime... (Probably the kluge in handle_import could be removed as well.)