Fixed possible null dereference