Bug fix for time varying background calculation