fix tread safe for php5