cherrypicked master for capybara stuff