When I solve limits I often convert a block in a notable limit multiplying and dividing it by the same quantity. For example: $$ \lim_{x \to 0} \frac{e^{\sin(x)}-1}{x} = \lim_{x \to 0} \frac{e^{\frac{\sin(x)}{x}x}-1}{x} = \lim_{x \to 0} \frac{e^{x}-1}{x} = 1 $$
I've noticed that I can't always apply this. For example: $$ \lim_{x \to 0} \frac{x^3+9x-9 \tan(x)}{-8x^3} = \frac{1}{4}\neq \lim_{x \to 0} \frac{x^3+9x-9 \frac{\tan(x)}{x}x}{-8x^3} = \lim_{x \to 0} \frac{x^3+9x-9x}{-8x^3}= -\frac{1}{8} $$
What's wrong in that passage? What rule am I violating?
Thanks