Fix type error for nested object (closes #7)

Fixes #7.