Fixed status checking code