rebuilding header and map