Backported CASSANDRA-5818 to cassandra-2.0

patch by Lyuben Todorov; reviewed by Mikhail Stepura