fix bug detected by static analysis tool