Fixed a bug with missing markers reference update

The bug sometimes was cause of impossibility to exit from marker detailed view
or to delete the selected marker, plus other visual issues.