Improve etcdir detection