Let $X_1,...,X_n$ be IID exponential distributions with parameter $\theta$. I have calculated their maximal likelihood estimator as follows:
The likelihood function is
$$L(\theta) = \theta^n e^{-\theta(\sum_{i=1}^{n}x_i)}$$
Thus the log-likelihood function is
$$l(\theta) = n \ln \theta - \theta \sum_{i=1}^{n}x_i$$
Setting $\frac{dl}{d\theta}=0$ and rearranging, we get that
$$\theta_{MLE} = \frac{n}{\sum_{i=1}^{n}x_i}$$
So far, I am agreeing with this answer on Stats stack exchange.
But then, taking the expectation, $\mathbb{E} \theta_{MLE} = \mathbb{E}\frac{n}{\sum_{i=1}^{n}x_i}=\frac{n}{\sum_{i=1}^{n}\mathbb{E}x_i}=\frac{n}{\sum_{i=1}^{n}1/\theta}=\theta$. Surely this means it is unbiased? The answers there say it is biased and I have been told it should be, and I am not sure where I am going wrong.