fix bug to generate wrong png file