fix a bug with undefined attributes