Fix bug in checking for mode compatibility