Fixes a bug with realX and realY.