Fix index out of bounds when LEM mapped out of range