Added an explicit pubsync() call to flush(), experimental for now