Fix Travis build and some coverity issues