Fix visual glitches in material and materialblack themes