use the right strndup()