Fix bug when calculating the real stacksize

Now the method is more robust
Prepare for 1.8.2 release