Move misplaced endif