TDQ-9320 check and fix several small code problems.