fix out-of-bound bug in filemanager

this should fix #43