Fixing endif on the incorrect position.