Fix for isssue #496

I have had the same problem on one of my machines and the following patch fixes it for me.