be a little smarter about when to redirect stderr

The fix in 0e34978 doesn't work in the most recent versions of IPython. Fixes #3 in that case.