Replace some uses of assert with CHECK_NOTNULL