Fix/build2

Fixing the build / tests and removing a global var

Feel free to squash, separated them for better reviewing