adapt for php5.3