folder detection improvement