Fixing up tests + bugs