Fixed exception thrown bug