Fix build and tests