Fixed a little bug when adding attribute that is nil