Add line number to exceptions in generators. Fixed SQL template.