Fixed a bug with sending headers