added casts on assignment if types don't match