Fix nasty nil pointer bug.