bugfix and formatting changes