set min and max duration correctly