update layers only when it's visible, linked to #5