fixed an edge case for delete, added in sumOfPaths