fix a bug in reassigning class attributes