Bugfixes. Un-breaking tests