adjusting the lag compensation code more