Change type of ni variable to unsigned int.