Add explicit braces to avoid dangling else

This was causing a warning