Check arity of #to_hash before calling. Closes #144