fixed a segfault in the handling of magic samples.