fix bug when temporal layer changes
Merge pull request #1127 from ruil2/temporal_bug_fix

fix bug when temporal layer changes