Additional fixes and type hinting for delete function