Fix OSX build and cppcheck

Change-Id: Idfdc7b2f34a49b5bab89460a84946a467ec8be6e