Fixed minor bug causing error handling to fail!