fix smashed stack bug