fix buggy arhg check for addOptPathEl and add test