Fix mode code