fixing possible js errors if view model is not defined