This re-applies a check-spaces fix that was part of 7920ea55 and got reverted along with the rest of that commit in df1f7232.