fix bugs introduced by previous coverity fixes