fixed measure code; untested