error in $scope data formatting