Fixed reference error in exception paths