Fix some bugs and improve the openbadge feature