Added more nastiness for dealing with static builds. Must clean this up
later.