fix segfault and add some debug output
fix typo in comment
removed redundant 'return -1'
Merge pull request #29 from ccaccb/fix_segfault

Fix segfault when inputting three page-arguments