Fixed bug for wrong measurement detection