Minor fix to checkDelete function