Changed popstack function.