Fix some segfaults + closes gh-15