js fix for preview