Fixed bug for wrong measurements