Added delete and fixed some bug.