Fix measurement bugs