Fixed minor bug with some exception cases