modified handling of level to make more consistent with other scripts