improving backgroundpage handling