stack bug fixing