Bug fix for detection sample extraction