Bug fixes

The code (as currently existing in the master branch) would not compile for me on OSX 10.9. Fixed syntax bug and added necessary C-library for getopt.