add stack size management