undefined index issue when building file list