clean code

fix 2 bugs