pulled 3 of Totte's fixes