Fixing compilation Warning and Errors