some fixes for AngularJS and PHP