fix selection breaking when messages array is full