Fixed some PHP 5.4 errors
Implemented a new exception handler