Do not rely on cached X state

Signed-off-by: Alexey Galakhov <agalakhov@gmail.com>