some bug fixing and some sonar fixing