Fixed extra compilation warnings and optimized builds