guarded against empty parameters in initPreview