code clean & bugfix