loader: fix base path extraction in shim_require