Fixed wrong line numbers in error messages for multi-line statements

Partially fixes #1351