Fixed a series of AngularJS errors