Fixed array overflow causing segfault, fixes #17

Should also solve issue #16
Thanks to ps-auxw @ IRC for finding this stupid bug!