fixed for php5.4+