Make sure that event handlers pass through environment variables.

Added test coverage for #142 and #143.