Fixed a bug for positioning of the cursor