Fixed line numbers in error messages and improved redefinition error (based on a patch by Jon Griffiths).