improve identity check