bugfix and change to delete method