Fixed a pair of bugs in the writeFiles() function.  Needed to account for the number of projected sensors.