Fix some data conversion bugs and clipping mask bugs