Fix compilation and tests