Fixed possible null dereference.