Solved issue #1 thanks to @fiskbil comment

The patch was just fixing the symptom, not the actual problem. The issue is that the index should be y*width+x, not y*height+x.
Update README.md
Update README.md
Merged branches