bugfix and some small changes