update attr function in init