Added isNil check