fix attributes and add some tests