Fix crash with casting other types to double.