Fix check of stack size in debug