Fixed segmentation fault in PHP5.4+