fix error identified by valgrind

Under certain circumstances, even though it didn't matter, valgrind complained that rmi was dependent on an uninitialized value. Changing the location of the test placates valgrind.