Bugfix and minor changes