added test_attr (and fixed one or two edge cases)