fix grouping, and bad placement of fi