fixed file autocomplete to work correctly with directories