fixed all bugs that made the tests fail, should be ready for encoding and raw tests