patch for php 5.2; other minor tunings

added a workaround for the lack of get_called_class() in php < 5.3