prevent index out of range
path/filepath -> path