XXX: fix logic