Should be `typeof terrain !== 'undefined')`