Whoops. That inner if statement was debugging code I accidentally left in. It *never* runs anymore.