Correctly get the mode before using it.