Clean up some access to null objects in the demo.

just moved stuff around to quiet error messages.