Fixed while loops skipping over the first line of a changed while stack