refactoring and bugfix, stability improved!