Post ALL the code, using code tags. See the "How to use this forum" post.
You may be exceeding an array bound somewhere.