Added correction of type when assigning values to attributes

Also fixed a typo in the comment