fixing toBedefined() method