Fixed exceptions and test for it