Update Package.php

The change creates session variable that stores the state of the code and prevents the code from executing more than once per session. It also prevents known issue with Varnish integration.