Some first bugfixes to previous commit