bugfix in needed stack depth