Huge hack to make serialization of dependencies work, other small changes