BSD sed lacks -r; fix #551