fix bug and complete CRUD