Made corrections to Pixel Write

Modified and added tmp width and height var.