Fixed some bugs in DWT.