Fix delay calculation