Fix mode handler crash