fixed bug in delete