Fix a bunch of segfault bugs.
Add .gitignore