Fixed a lot of warning, some of them were hidden bugs.