fix scope in template