Cursor moves to end after selecting name