cwc: fix some NULL dereferences