fix order of checks