Fixed segmentation error

Also added a .gitignore file.