optimize layer refresh