Fixed compilation warnings

Fixed a number of compilation warnings: 
- comparison between size_t and unsigned
- implicit cast from int to bool