refactoring wmode fix