safeCast for char, int