Have you defined a variable "j" and assigned a proper value?