fix writing images/icons using python3