Fixed crash because of out of bound index
Merge pull request #28 from Tif-tof/master

Fixed crash because of out of bound index and fixed .gitignore