Fix Segmentation fault

Fix for #32