Issue #29: Proper cleanup of unrank