Modified loadLibs function