fixed strncmp logic