Adding check for nil