Huge bugfixes