update_CWD to use strncmp instead of memcmp