fix #2361: index out of bounds in dir chooser