fix bugs to make tests green again