Fixed a bug in delete