Fix crash on preview