Fix for painting issue