Implemented tests for statsd and a couple of bug fixes