fixed minor bug with if statements, returned header object instead of header body