code cleaning: fix 2 minor bugs