handle old versions of php for type casting