Bugfix/coverity

Some coverity fixes