Error fix when switching to editor