XXX: fix loop