some codes improvements