more refactoring
fix hud bug