fix issue which broke working w/ token services

also fixes allowedReferers issue
Merge pull request #147 from phpmaps/important-php-fixes

smarter about referrers and zip header