Fixed unused variables.  Fixes #3749.

One of the unused variables was actually a bug... ooops