corrected initialize wrt XMAX