code clean & fix bugs