isolated scope and fix bug with registration
change how attribute register itself