fixed header overwriting bug