Fixes to make libs run on many versions