fixed the bug with not deleting properly