Fix callback issues for newer version of PHP