This patch fixes the mentioned issue. I was not sure how to format the code, are you using some specific tool to do it?