Make sure to throw the right exception (fixes #39)