Fixed a potential painting error.