Fix two bugs where the wrong field or variable is accessed.

Change-Id: I3f260c2259b6e2739ccb06ddf616d2d07f3dc5bf