Fixed issues with int vs size_t and a few other warnings