trying to place cursor at correct position