fix inconsistency in queue size checking which can lead to a connection stalling permanently