Backport CASSANDRA-6196 to 1.2

patch by Mikhail Stepura; reviewed by Aleksey Yeschenko for
CASSANDRA-6196