safe text handling