Fixed the checkDelete function