fix a bug found by coverity