Tree drag and drop dropTargetData.getItemIdInto() help

I am trying to reorder items in a tree that are on a same level while doing drag and drop.
Immagine following items layout in a tree

+RootItem1
+ subItem1
+ subItem2
+ subItem3

when I drag subItem3 and drop it before subItem1, dropTargetData.getItemIdInto()(that whould be a parent of that subtree) mostly returns RootItem1, but sometimes it returns null, even though on a GUI level it appears in a correct location. This value mixes up all my persistence logic behind GUI.
I thought maybe I was not precise enough while dropping subItem3 for the first time, but I tried several times and event occurred again.
I noticed also that this happens when you try to drag and drop an item to the first location in a sub tree.
Is it a normal behaviour or is there something I’m missing? Without this information I’m unable to detect correct parent of an item while drag&dropping.

Thank you