Fix withPixel to save and restore the context