Added back in the changes that were somehow undone by commit 291ea8b653 (taking lossless if no good lossy matches found)