Smallfixes

Fixes a few issues of https://scan.coverity.com/projects/1138