Avoid GCC warnings (-Wold-style-casts and -Wshadow)

I worked around a few warnings which my GCC (4.7.2) spat out.

See also issue #83.