Fixed the null for calculateXY. calculateXY is verified to work properly.