validity check for mode