Forward-port of recent spray patches

This PR aggregates a number of patches that we have applied to spray this week.
would it be worth it to keep this instance in a `val` ?