method to ensure data is a string