bugfix and coding convention refactoring