Added resample length adjustment. Should fix #115