update preview code.