fix and test for multiple static linking