added sd initialization process and some modification