fix bug in delete() method