bugfix and debugging