fix broken library loading and build problems