fix some errors & add delete codes