fixed bug in how to compute the last pixel
mixed up left and right edge in gold computation for x