Fixed several line numbering bugs