[fix] fast listdir undefined behaviour