Fix attribute handling

Fixes #23.