fixed bugs caused by json switch