use strncpy in getProgramName to avoid garbage