replace some string handling with strncat