Thank you very much for this patch. I'm surprised it hasn't been integrated already. I was just about to solve this exact problem today.