finish header, and fixed session bug