Fix data type conversion to avoid PHP warning.