some fixes suggested by sonar