Fix bracket-adding code

Fixes made in 449b602b87180210d65b1122dc6001dc4e5f6097 were accidentally
undone in 620362b2bd363d1beadf144d4653938d979fa74f .