Found a problem in the thread safety when using getWidth and getHeight methods. Can't find a simple solution, though.