Correct UpdateFramebuffer function