Changed order of status checking.