fixed bug in delete method.