Try to convert to unit instead of isinstance check