Fixed WINDOW_STATE mask bug, should use & instead in [].