add doBuildAttributes to handle attributes before build