Fixed an exception related bug