fix history stack issue