Bug fixes to stable Rails 4.1 branch

Merging bug-fix branch into stable master branch.  cc @diegoviola