add a null check for 'settings'