Fixed tests and added a test for the new fix.