Various scan-build fixes