fixed bug in consensus()