Fix crash with dock while opening sessions, fix off-by-one offset for dock preview image generation