some modification, error eliminated