Convert attributes when set

Fixes #18