First off, error messages come with line numbers.
Looking in the immediate vicinity of those line numbers and carefully read the code usually helps.

Also, read this...