adapt for older php