fixed bugs uncovered by Cynthia