Fixed some name collision and bugs