much better kstack handling