fix crash on preview