Fix bugs of method contains() and delete()