Tests, fix Segmentation fault