Some important  bugfixes