changes to better support different PHP versions