add test for measure ordering and fix wierd issue where spec causes SIGSEGV