get rid of global variables (they get messed up because of static libraries)