Several major bug fixes related to getting correct line numbers