fix a bug in response header processing in imagemanip; change preemptive auth strategy