Depth bug fix in repainting