Fixed several errors provided by gcc warnings