Bugfix and a few adjustments