Fix wrong cx and cy assignment