Fixed bug in delete