fix a bug: update index before accessing fldr element