adjust script for older PHP versions