Catch KeyError and reraise as AttributeError (fixes #2)