Fixed bug in dynamic loading. The call to dlerror() was performed too many times, and a NULL pointer was passed, causing a segfault.