fixed bug that I immediately created, and added a few tests