fixed infinite recurson bug