Small fix in xap() function