add delete method and fix some issues