add local scripts and fix controller scope problems