Fix sample matching

Return the actual matched sample rather than the last sample in the
library.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>