Solving the wm double invocation bug