fixed the bug, now delete function and search function works.