fix segfault (issue #11)

This fixes issue #11.