add defined check at 2 views