#5 bug was fixed. Tested for 1000 x 500 resolution