fix code for older php