bugfixes, still cant pass unit tests