Fixed a crash caused by setting preview mode.