Fixed R index errors, as well.