Use long, not Long.  Also for lastTargetId