fix a few bugs from last dynamic linking build system commit