Fix WordUnderCursor and add tests