Fixing a missplaced 'endif'