Fix loading of dynamic libraries