fix some bugs found with more testing, additional tests