Made some final bugfixes.