added getpixel assertion and fixed out of range bug