modify some codes for correcting errors for demo