Fix a bunch of annotation issues and bugs

They are found by a partial Closure Compilter scan and jshint scan.