fixing bug: interval doe nor clear from  funciton