Fix safe conversions functions in the case of too long inputs