Fixed bugs minor which are warned on sonar.