Fix for #1733: mishandling of factorials when taking limits

I'm assuming that the line `e = e.rewrite(gamma)` is (a) not too expensive, and (b) doesn't interfere with functions that don't include factorial terms.

See #1733 for the discussion that led to this PR.