fixed bug in viewModel.js that caused an infinite loop