latest misc changes trying to fix two major bugs