Fixed a logic bug whereby a producer hung after leader election