Fixes regressions in sprockets >= 2.1.4

Fixes #5311
Fixes #5313