Fix bug in barometer handler and fix warnings