Fix some coverity issues and a XXX