Fixes for DTW