variable "n" is needed before it was actually created. bug fixed.

variable "n" was needed by code before it had actually been created.  this pull fixes that bug.