fix out-of-bound bug in filemanager