added lag compensation