fixed crashes for certain test cases on php 5.3