upgrade to Rails 4.0.4 and partially fix tests