added __str__ and fixed bug in test