preview_mode fix undefined check