fix sr_clean

Environment key checks etc.