Minor changes to make it compile as c++ and a missing strcpy