cleanup tests, cleanup global variables, all tests passing
Merge pull request #320 from segmentio/fix/tests

cleanup tests, cleanup global variables, all tests passing