Give better error message on unknown attribute
Added basic tests