few bug fixes

fixed a bug with incorrect addition of point to chain
fixed a bug making unable to delete the last existing point in chain
(if length == 1)
fixed a bug allowing to add the same point twice
check comments for TODO.