fixed stackoverflow bug; null check
updte