#36 Fixed Javascript bug that broke the preview mode switching