Changes for php5.2 compatibility