scope control bug fixes