correct errors detected by scan-build