Fixed index error on option parsing.

Also merges in master. There was a merge conflict on `CMakeLists.txt`, so pay attention to that addition. I'm not sure if it needs to be there or not.