better hook to capture stderr