Some fixes for xz->xy change. Not finished yet...