update code then can compatible with php5.2