fixed two bugs spotted in testing