Fixed code to pass XINDEX tests