adapting ws for php5.3