Fix bugs in Cmd_CompleteFileList and make it return directories first