corrected end calculation of tracks
added debug log
fix for deletion