bug found in the restack condition, to fix