Fix error - exception should be instantiated

Fix bug in code