some changes to support old versions of php