Fix nullpointerexception in DeleteCommand and index error in searchManager