Small fix to throw exceptions