fixed charref handling
Remove redundant switches