Changes to make it work with slightly older PHP