PHP incompatibility fixes

Fix issues related to older PHP versions.