FIX prewhitening bug

Terrible bug. Addressed in #1319 but we should merge this as a separate commit to make backporting easier.