pull latest from master into rails-4 branch

pull latest from master into rails-4 branch