fix bug in format booleans

<< binds more tightly than ? so it's necessary to wrap the latter in parenthesis