Fix exceptions and other corrections