fixed bug found by coverity