Fixed some small bugs and updated pubsub test script