Fix a potential memory error in Way-V
More refactoring and cleanup for multi-host