apply fix for CASSANDRA-4834 to the 1.2 branch.  See also CASSANDRA-5504
merge from 1.2