fix 2 bugs found by coverity