Changed most functions/variables to use static, fixed crash if called when PHP was in exception mode