Fixes PATH and environment cleanup when running scripts

The hack in the init scirpt is ugly for now.