updated to run for php5