Set I and J to correct values.