Fixed bugs with the measurement