fixed some bugs based off the added tests