fix bug found by coverity