Added a null check when returning names