Changed order of checks