[repo] bugfix and some code improvements