Forward-port of recent spray patches

This PR aggregates a number of patches that we have applied to spray this week.
Yes, thanks for finding this copy-pasta bug!