small changes to dynamic linking: should work on linux/mac now