Added stack growing check  function