added some status checking