change strncpy to memcpy