Fixing tests and squashing bugs