Try to fix tests and some Sonar warnings