Fix error output redirection

This fixes issue #303