fix a stacktop ptr offset bug, add some debug code