Improve generating Icons e.g. for LibreOffice

This should fix generating Icons e.g. for LibreOffice whereas the icon is missing sometimes. Please check this before you merge it!