fix some pixel conversion bugs