Attempt to fix IllegalStateException on dimension change

Signed-off-by: Ross Allan <rallanpcl@gmail.com>