fixing array index issue when finding mappings