bugfix and minor changes