wm: fix optimization issue